home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / nvdc87 / process / parent.pas < prev    next >
Pascal/Delphi Source File  |  1987-08-17  |  2KB  |  62 lines

  1. PROGRAM Parent;
  2.  
  3. uses dos;
  4.  
  5. {$M 8192,8192,8192}
  6. {$I LISTOF.VAR}
  7. {$I PASSDATA.TYP}
  8. {$I HEX.INC}
  9.  
  10. VAR
  11.   P     : passdata;
  12.   tempS : string[6];
  13.   tempO : string[6];
  14.  
  15. BEGIN
  16.   WriteLn('THIS is the PARENT program.');
  17.   WriteLn('===========================');
  18.   P.password := 'BORLANDint';
  19.   P.status := 0;
  20.   Write('What string shall I pass to the children?:');
  21.   ReadLn(P.name);
  22.   thing := P.name;
  23.   Str(seg(P),tempS);
  24.   Str(ofs(P),tempO);
  25.   Exec('CHILDA.EXE',tempS+' '+tempO);
  26.   WriteLn;
  27.   WriteLn('NOW we are back to the parent program');
  28.   CASE P.status OF
  29.     0 : WriteLn('WHAT we have here is a failure to communicate');
  30.     1 : BEGIN
  31.           WriteLn('THE STRING we got is "',P.name,'"');
  32.           WriteLn('THE INTEGER we got is ',P.number);
  33.         END;
  34.     2 : WriteLn('The user halted the child process with ^Break');
  35.     3..$FF : WriteLn('OOPS! The child process crashed in an ',
  36.                      'unexpected way.');
  37.     ELSE
  38.       Write('The child process crashed with error $');
  39.       WriteLn(HexByte(P.status AND $FF));
  40.   END;
  41.   status := 0;
  42.   keyword := 'BORLANDint';
  43.   Str(seg(mark1),tempS);
  44.   Str(ofs(mark1),tempO);
  45.   Exec('CHILDB.EXE',tempS+' '+tempO);
  46.   WriteLn;
  47.   WriteLn('NOW we are back to the parent program');
  48.   CASE status OF
  49.     0 : WriteLn('WHAT we have here is a failure to communicate');
  50.     1 : BEGIN
  51.           WriteLn('THE LONGINT we got is ',L);
  52.           WriteLn('THE STRING we got is "',thing,'"');
  53.         END;
  54.     2 : WriteLn('The user halted the child process with ^Break');
  55.     3..$FF : WriteLn('OOPS! The child process crashed in an ',
  56.                      'unexpected way.');
  57.     ELSE
  58.       Write('The child process crashed with error $');
  59.       WriteLn(HexByte(status AND $FF));
  60.   END;
  61. END.
  62.